package com.andy.common.base

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import androidx.viewbinding.ViewBinding

/**
 * Author:Andy
 * Date:2023/3/20 15:39
 * Description:BaseFragment
 */
abstract class BaseFragment<VB : ViewBinding> : Fragment() {
    protected open var mBinding: VB? = null
    override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
        mBinding = getViewBinding()
        return mBinding?.root
    }

    abstract fun getViewBinding(): VB

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)
        initStatusBar()
        initNavigationBar()
    }

    open fun initStatusBar() {
    }

    open fun initNavigationBar() {
    }

    override fun onDestroy() {
        super.onDestroy()
        mBinding = null
    }
}